//
//  UITextField+Extension.m
//  Instagram
//
//  Created by monkey on 2019/4/13.
//  Copyright © 2019 itcast. All rights reserved.
//

#import "UITextField+Extension.h"

@implementation UITextField (Extension)

- (instancetype)initWithPlaceholder:(NSString *)placeholder fontSize:(CGFloat)fontSize textColor:(UIColor *)textColor isSecureTextEntry:(BOOL)isSecureTextEntry keyboardType:(UIKeyboardType)keyboardType
{
    if (self = [super init]) {
        self.placeholder = placeholder;
        self.font = [UIFont systemFontOfSize:fontSize];
        self.textColor = textColor;
        self.secureTextEntry = isSecureTextEntry;
        self.clearButtonMode = UITextFieldViewModeWhileEditing;
        self.borderStyle = UITextBorderStyleRoundedRect;
        self.keyboardType = keyboardType;
        [self sizeToFit];
    }
    
    return self;
}

+ (instancetype)textFieldWithPlaceholder:(NSString *)placeholder fontSize:(CGFloat)fontSize textColor:(UIColor *)textColor isSecureTextEntry:(BOOL)isSecureTextEntry keyboardType:(UIKeyboardType)keyboardType
{
    return [[self alloc] initWithPlaceholder:placeholder fontSize:fontSize textColor:textColor isSecureTextEntry:isSecureTextEntry keyboardType:keyboardType];
}

@end
